Configure Okta for Identity
The Moesif Developer Portal requires an Identity Provider to secure the front-end application and control access. Below are the steps required to set up Okta as an identity provider to work with the Moesif Developer Portal.
Creating the App within Okta
To configure Okta for the Moesif Developer Portal, follow these steps:
- Log into Okta:
- From the left-side menu, click on Applications and select Applications.
- Create a New App Integration:
- Click the Create App Integration button on the Applications page.
- Select App Type:
- In the modal that appears:
- Under Sign-in method, choose OIDC - OpenID Connect.
- Under Application type, select Single-Page Application.
- Click Next.
- In the modal that appears:
- Configure App Details:
- App integration name: Enter a name, such as
Developer Portal. - Grant type: Ensure
Authorization CodeandRefresh Tokenare selected. - Sign-in redirect URIs: Add the redirect URI for your environment, e.g.,
http://127.0.0.1:4000/login/callbackif running locally. - Sign-out redirect URIs: Add a URI like
http://127.0.0.1:4000/. - Assignments: Choose
Skip group assignment for nowunless specific group assignments are needed.
- App integration name: Enter a name, such as
- Save the Configuration:
- Scroll to the bottom of the page and click Save to save the application settings.
Adding Okta to the Moesif Developer Portal
To connect Okta to the Developer Portal, you’ll need to update the environment variables.
Retrieving Values from Okta
- Navigate to the Applications screen in the Okta console.
- Select the application you created for the Developer Portal.
- Go to the General tab.
- Locate the following values and copy them:
- Client ID: Use this value for the
REACT_APP_OKTA_CLIENT_IDentry in the frontend environment configuration. - Issuer (Org URL): Use this value for the
REACT_APP_OKTA_ORG_URLin the frontend configuration and theOKTA_DOMAINin the backend configuration. When configuring the frontend, append/oauth2/defaultto this URL.
- Client ID: Use this value for the
- Generate an API Token:
- Follow Okta’s API token creation guide.
- Use the token for the
OKTA_API_TOKENentry in the backend environment configuration.
Updating Environment Variables
Environment Variables for Node
To configure Okta in the Developer Portal, you will need to update two .env files located in different parts of your project:
my-dev-portal-api/.env: This is where you configure the backend API environment.my-dev-portal/.env: This is where you configure the frontend environment.
Backend Configuration
- Open the
my-dev-portal-api/.envfile. - Replace the following lines with the correct values:
OKTA_DOMAIN="https://your-okta-url.okta.com/"
OKTA_API_TOKEN="your_api_token_here"
OKTA_APPLICATION_ID="your_app_client_id_here"
- Save the
.envfile to ensure the updated values are persisted.
Frontend Configuration
- Open the
my-dev-portal/.envfile. - Replace the following lines with the correct values:
REACT_APP_OKTA_ORG_URL="https://yoururl.okta.com/oauth2/default"
REACT_APP_OKTA_CLIENT_ID="Your Okta Client ID"
- Save the
.envfile to ensure the updated values are persisted.
Environment Variables for Docker
- Open the
distribution/docker-compose.ymlfile. - Add or update the following entries in the relevant service configuration under
environment:
dev-portal-api:
environment:
- OKTA_DOMAIN="https://your-okta-url.okta.com/"
- OKTA_API_TOKEN="your_api_token_here"
- OKTA_APPLICATION_ID="your_app_client_id_here"
dev-portal:
environment:
- REACT_APP_OKTA_ORG_URL="https://yoururl.okta.com/oauth2/default"
- REACT_APP_OKTA_CLIENT_ID="Your Okta Client ID"
- Save the
docker-compose.ymlfile to ensure the updated values are persisted.
Next Steps
Once all the values are added, save the files to ensure the updated values are persisted. You can then proceed to configure your billing provider.
Verifying Identity Provider Functionality
After configuring the rest of the developer portal, verify the identity provider functionality in the Okta console. Navigate to the Directory > People screen, where you should see your newly created user tracked by their email address.